package com.sky.controller.user;

import com.sky.pojo.Category;
import com.sky.result.Result;
import com.sky.service.user.UserCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Slf4j
@RestController
@RequestMapping("/user/category")
@Api(tags = "C端-分类接口")
public class UserCategoryController {
    @Autowired
    private UserCategoryService userCategoryService;
    @ApiOperation("查询分类")
    @GetMapping("/list")
    //查询分类是要考虑的是这样类菜品是否停售，所以查询的菜品的状态是1(status=1)的菜品
    public Result<List<Category>> list(Integer type){
        List<Category> list = userCategoryService.list(type);
        return Result.success(list);
    }
}
